class LogisticsController < ApplicationController
  before_filter :check_administrator_role
  # GET /logistics
  # GET /logistics.xml
  def index
    @logistics = Logistic.find(:all)

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @logistics }
    end
  end

  # GET /logistics/1
  # GET /logistics/1.xml
  def show
    @logistic = Logistic.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @logistics }
    end
  end

  # GET /logistics/new
  # GET /logistics/new.xml
  def new
    @logistic = Logistic.new

    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @logistics }
    end
  end

  # GET /logistics/1/edit
  def edit
    @logistic = Logistic.find(params[:id])
  end

  # POST /logistics
  # POST /logistics.xml
  def create
    @logistic = Logistic.new(params[:logistic])

    respond_to do |format|
      if @logistic.save
        flash[:notice] = 'Logistics was successfully created.'
        format.html { redirect_to(logistics_url)}
        format.xml  { render :xml => @logistic, :status => :created, :location => @logistic }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @logistic.errors, :status => :unprocessable_entity }
      end
    end
  end

  # PUT /logistics/1
  # PUT /logistics/1.xml
  def update
    @logistic = Logistic.find(params[:id])

    respond_to do |format|
      if @logistic.update_attributes(params[:logistic])
        flash[:notice] = 'Logistic was successfully updated.'
        format.html { redirect_to(logistics_url) }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @logistic.errors, :status => :unprocessable_entity }
      end
    end
  end

  # DELETE /logistics/1
  # DELETE /logistics/1.xml
  def destroy
    @logistics = Logistic.find(params[:id])
    @logistics.destroy

    respond_to do |format|
      format.html { redirect_to(logistics_url) }
      format.xml  { head :ok }
    end
  end

  def edit_province
    @logistic = Logistic.find(params[:id])
    @provinces = Province.find(:all)
  end
end
